
package us.hornerscorners.lamppost.atna.receiver;

import com.nesscomputing.syslog4j.server.SyslogServer;
import com.nesscomputing.syslog4j.server.impl.net.udp.UDPNetSyslogServerConfig;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import us.hornerscorners.lamppost.ihecommon.config.AtnaConfig;
import us.hornerscorners.lamppost.ihecommon.config.AtnaProtocolType;


public class AuditEventUdpReceiver extends AbstractAuditEventReceiver {

    /** Field description */
    private final Logger logger = LoggerFactory.getLogger(getClass());

    /**
     * Constructs ...
     *
     * @param config
     */
    public AuditEventUdpReceiver(AtnaConfig config) {

        super(config, AtnaProtocolType.udp);
    }

    /**
     * Method description
     *
     */
    @Override
    public void initialize() {

        UDPNetSyslogServerConfig sysconfig = new UDPNetSyslogServerConfig();

        AtnaConfig atnaConfig = getAtnaConfig();

        sysconfig.setHost(atnaConfig.getServiceHost());
        sysconfig.setPort(atnaConfig.getPort());

        SyslogServer.createInstance(getProtocol(), sysconfig);
    }

}
